/**
 */
package mvc_generator.mVCGenerator.impl;

import java.util.Collection;

import mvc_generator.mVCGenerator.Alternative;
import mvc_generator.mVCGenerator.Expression;
import mvc_generator.mVCGenerator.MVCGeneratorPackage;

import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Alternative</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link mvc_generator.mVCGenerator.impl.AlternativeImpl#getConsequence <em>Consequence</em>}</li>
 *   <li>{@link mvc_generator.mVCGenerator.impl.AlternativeImpl#getAlternant <em>Alternant</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class AlternativeImpl extends ControlStructureImpl implements Alternative
{
  /**
   * The cached value of the '{@link #getConsequence() <em>Consequence</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getConsequence()
   * @generated
   * @ordered
   */
  protected EList<Expression> consequence;

  /**
   * The cached value of the '{@link #getAlternant() <em>Alternant</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getAlternant()
   * @generated
   * @ordered
   */
  protected EList<Expression> alternant;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected AlternativeImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return MVCGeneratorPackage.Literals.ALTERNATIVE;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<Expression> getConsequence()
  {
    if (consequence == null)
    {
      consequence = new EObjectContainmentEList<Expression>(Expression.class, this, MVCGeneratorPackage.ALTERNATIVE__CONSEQUENCE);
    }
    return consequence;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<Expression> getAlternant()
  {
    if (alternant == null)
    {
      alternant = new EObjectContainmentEList<Expression>(Expression.class, this, MVCGeneratorPackage.ALTERNATIVE__ALTERNANT);
    }
    return alternant;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case MVCGeneratorPackage.ALTERNATIVE__CONSEQUENCE:
        return ((InternalEList<?>)getConsequence()).basicRemove(otherEnd, msgs);
      case MVCGeneratorPackage.ALTERNATIVE__ALTERNANT:
        return ((InternalEList<?>)getAlternant()).basicRemove(otherEnd, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case MVCGeneratorPackage.ALTERNATIVE__CONSEQUENCE:
        return getConsequence();
      case MVCGeneratorPackage.ALTERNATIVE__ALTERNANT:
        return getAlternant();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @SuppressWarnings("unchecked")
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case MVCGeneratorPackage.ALTERNATIVE__CONSEQUENCE:
        getConsequence().clear();
        getConsequence().addAll((Collection<? extends Expression>)newValue);
        return;
      case MVCGeneratorPackage.ALTERNATIVE__ALTERNANT:
        getAlternant().clear();
        getAlternant().addAll((Collection<? extends Expression>)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case MVCGeneratorPackage.ALTERNATIVE__CONSEQUENCE:
        getConsequence().clear();
        return;
      case MVCGeneratorPackage.ALTERNATIVE__ALTERNANT:
        getAlternant().clear();
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case MVCGeneratorPackage.ALTERNATIVE__CONSEQUENCE:
        return consequence != null && !consequence.isEmpty();
      case MVCGeneratorPackage.ALTERNATIVE__ALTERNANT:
        return alternant != null && !alternant.isEmpty();
    }
    return super.eIsSet(featureID);
  }

} //AlternativeImpl
